<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-- | Types used by the runtime interpreter</span><span>
</span><span id="line-4"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Runtime.Interpreter.Types</span><span>
</span><span id="line-5"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#Interp"><span class="hs-identifier">Interp</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-6"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServ"><span class="hs-identifier">IServ</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-7"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServInstance"><span class="hs-identifier">IServInstance</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-8"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServConfig"><span class="hs-identifier">IServConfig</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-9"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServState"><span class="hs-identifier">IServState</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-10"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-11"></span><span class="hs-keyword">where</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#"><span class="hs-identifier">GHCi.RemoteTypes</span></a></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.Message.html#"><span class="hs-identifier">GHCi.Message</span></a></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.Message.html#Pipe"><span class="hs-identifier">Pipe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier">FastString</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.html#"><span class="hs-identifier">Foreign</span></a></span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Concurrent.html#"><span class="hs-identifier">Control.Concurrent</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../process/src/System.Process.html#"><span class="hs-identifier">System.Process</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../process/src/System.Process.Common.html#ProcessHandle"><span class="hs-identifier">ProcessHandle</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../process/src/System.Process.Common.html#CreateProcess"><span class="hs-identifier">CreateProcess</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span class="hs-comment">-- | Runtime interpreter</span><span>
</span><span id="line-25"></span><span class="hs-keyword">data</span><span> </span><span id="Interp"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#Interp"><span class="hs-identifier hs-var">Interp</span></a></span></span><span>
</span><span id="line-26"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="ExternalInterp"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#ExternalInterp"><span class="hs-identifier hs-var">ExternalInterp</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServConfig"><span class="hs-identifier hs-type">IServConfig</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServ"><span class="hs-identifier hs-type">IServ</span></a></span><span> </span><span class="hs-comment">-- ^ External interpreter</span><span class="hs-cpp">
#if defined(HAVE_INTERNAL_INTERPRETER)
</span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="InternalInterp"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#InternalInterp"><span class="hs-identifier hs-var">InternalInterp</span></a></span></span><span>                     </span><span class="hs-comment">-- ^ Internal interpreter</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- | External interpreter</span><span>
</span><span id="line-32"></span><span class="hs-comment">--</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- The external interpreter is spawned lazily (on first use) to avoid slowing</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- down sessions that don't require it. The contents of the MVar reflects the</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- state of the interpreter (running or not).</span><span>
</span><span id="line-36"></span><span class="hs-keyword">newtype</span><span> </span><span id="IServ"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServ"><span class="hs-identifier hs-var">IServ</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="IServ"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServ"><span class="hs-identifier hs-var">IServ</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.MVar.html#MVar"><span class="hs-identifier hs-type">MVar</span></a></span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServState"><span class="hs-identifier hs-type">IServState</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-comment">-- | State of an external interpreter</span><span>
</span><span id="line-39"></span><span class="hs-keyword">data</span><span> </span><span id="IServState"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServState"><span class="hs-identifier hs-var">IServState</span></a></span></span><span>
</span><span id="line-40"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="IServPending"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServPending"><span class="hs-identifier hs-var">IServPending</span></a></span></span><span>                 </span><span class="hs-comment">-- ^ Not spawned yet</span><span>
</span><span id="line-41"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="IServRunning"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServRunning"><span class="hs-identifier hs-var">IServRunning</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServInstance"><span class="hs-identifier hs-type">IServInstance</span></a></span><span>  </span><span class="hs-comment">-- ^ Running</span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span class="hs-comment">-- | Configuration needed to spawn an external interpreter</span><span>
</span><span id="line-44"></span><span class="hs-keyword">data</span><span> </span><span id="IServConfig"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServConfig"><span class="hs-identifier hs-var">IServConfig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="IServConfig"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServConfig"><span class="hs-identifier hs-var">IServConfig</span></a></span></span><span>
</span><span id="line-45"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="iservConfProgram"><span class="annot"><span class="annottext">IServConfig -&gt; String
</span><a href="GHC.Runtime.Interpreter.Types.html#iservConfProgram"><span class="hs-identifier hs-var hs-var">iservConfProgram</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>   </span><span class="hs-comment">-- ^ External program to run</span><span>
</span><span id="line-46"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservConfOpts"><span class="annot"><span class="annottext">IServConfig -&gt; [String]
</span><a href="GHC.Runtime.Interpreter.Types.html#iservConfOpts"><span class="hs-identifier hs-var hs-var">iservConfOpts</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ Command-line options</span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservConfProfiled"><span class="annot"><span class="annottext">IServConfig -&gt; Bool
</span><a href="GHC.Runtime.Interpreter.Types.html#iservConfProfiled"><span class="hs-identifier hs-var hs-var">iservConfProfiled</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>     </span><span class="hs-comment">-- ^ Use Profiling way</span><span>
</span><span id="line-48"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservConfDynamic"><span class="annot"><span class="annottext">IServConfig -&gt; Bool
</span><a href="GHC.Runtime.Interpreter.Types.html#iservConfDynamic"><span class="hs-identifier hs-var hs-var">iservConfDynamic</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>     </span><span class="hs-comment">-- ^ Use Dynamic way</span><span>
</span><span id="line-49"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservConfHook"><span class="annot"><span class="annottext">IServConfig -&gt; Maybe (CreateProcess -&gt; IO ProcessHandle)
</span><a href="GHC.Runtime.Interpreter.Types.html#iservConfHook"><span class="hs-identifier hs-var hs-var">iservConfHook</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../process/src/System.Process.Common.html#CreateProcess"><span class="hs-identifier hs-type">CreateProcess</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../process/src/System.Process.Common.html#ProcessHandle"><span class="hs-identifier hs-type">ProcessHandle</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Hook</span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservConfTrace"><span class="annot"><span class="annottext">IServConfig -&gt; IO ()
</span><a href="GHC.Runtime.Interpreter.Types.html#iservConfTrace"><span class="hs-identifier hs-var hs-var">iservConfTrace</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>     </span><span class="hs-comment">-- ^ Trace action executed after spawn</span><span>
</span><span id="line-51"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-52"></span><span>
</span><span id="line-53"></span><span class="hs-comment">-- | External interpreter instance</span><span>
</span><span id="line-54"></span><span class="hs-keyword">data</span><span> </span><span id="IServInstance"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServInstance"><span class="hs-identifier hs-var">IServInstance</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="IServInstance"><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#IServInstance"><span class="hs-identifier hs-var">IServInstance</span></a></span></span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="iservPipe"><span class="annot"><span class="annottext">IServInstance -&gt; Pipe
</span><a href="GHC.Runtime.Interpreter.Types.html#iservPipe"><span class="hs-identifier hs-var hs-var">iservPipe</span></a></span></span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghci/src/GHCi.Message.html#Pipe"><span class="hs-identifier hs-type">Pipe</span></a></span><span>
</span><span id="line-56"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservProcess"><span class="annot"><span class="annottext">IServInstance -&gt; ProcessHandle
</span><a href="GHC.Runtime.Interpreter.Types.html#iservProcess"><span class="hs-identifier hs-var hs-var">iservProcess</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../process/src/System.Process.Common.html#ProcessHandle"><span class="hs-identifier hs-type">ProcessHandle</span></a></span><span>
</span><span id="line-57"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservLookupSymbolCache"><span class="annot"><span class="annottext">IServInstance -&gt; UniqFM FastString (Ptr ())
</span><a href="GHC.Runtime.Interpreter.Types.html#iservLookupSymbolCache"><span class="hs-identifier hs-var hs-var">iservLookupSymbolCache</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="iservPendingFrees"><span class="annot"><span class="annottext">IServInstance -&gt; [HValueRef]
</span><a href="GHC.Runtime.Interpreter.Types.html#iservPendingFrees"><span class="hs-identifier hs-var hs-var">iservPendingFrees</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">[</span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#HValueRef"><span class="hs-identifier hs-type">HValueRef</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-59"></span><span>      </span><span class="hs-comment">-- ^ Values that need to be freed before the next command is sent.</span><span>
</span><span id="line-60"></span><span>      </span><span class="hs-comment">-- Threads can append values to this list asynchronously (by modifying the</span><span>
</span><span id="line-61"></span><span>      </span><span class="hs-comment">-- IServ state MVar).</span><span>
</span><span id="line-62"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span></pre></body></html>